var apiTable = [
    {name: 'API_POST_LOGIN', env: 'development', api: 'http://119.147.37.168:9084/api/user/login'},
    {name: 'API_POST_LOGIN', env: 'production', api: 'http://119.147.37.168:9084/api/user/login'},

    {name: 'API_GET_USER_BY_TOKEN', env: 'development', api: 'http://119.147.37.168:9084/api/user/token/'},
    {name: 'API_GET_USER_BY_TOKEN', env: 'production', api: 'http://119.147.37.168:9084/api/user/token/'},

    {name: 'API_GET_LOGOUT', env: 'development', api: 'http://119.147.37.168:9084/api/user/logout/'},
    {name: 'API_GET_LOGOUT', env: 'production', api: 'http://119.147.37.168:9084/api/user/logout/'},

    {name: 'API_POST_CHANGE_PWD', env: 'development', api: 'http://119.147.37.168:9084/api/user/changepwd/'},
    {name: 'API_POST_CHANGE_PWD', env: 'production', api: 'http://119.147.37.168:9084/api/user/changepwd/'},

    {name: 'API_GET_USER_MENU', env: 'development', api: 'http://119.147.37.168:9084/api/user/menu/'},
    {name: 'API_GET_USER_MENU', env: 'production', api: 'http://119.147.37.168:9084/api/user/menu/'},

    {name: 'API_GET_CMS_SITE_LIST', env: 'development', api: 'http://119.147.37.168:9086/api/cms/site/list'},
    {name: 'API_GET_CMS_SITE_LIST', env: 'production', api: 'http://119.147.37.168:9086/api/cms/site/list'},

    {name: 'API_POST_CMS_SITE_SAVE', env: 'development', api: 'http://119.147.37.168:9086/api/cms/site/save'},
    {name: 'API_POST_CMS_SITE_SAVE', env: 'production', api: 'http://119.147.37.168:9086/api/cms/site/save'},

    {name: 'API_GET_CMS_CATE_LIST', env: 'development', api: 'http://119.147.37.168:9086/api/cms/cate/list'},
    {name: 'API_GET_CMS_CATE_LIST', env: 'production', api: 'http://119.147.37.168:9086/api/cms/cate/list'},

    {name: 'API_POST_CMS_CATE_SAVE', env: 'development', api: 'http://119.147.37.168:9086/api/cms/cate/save'},
    {name: 'API_POST_CMS_CATE_SAVE', env: 'production', api: 'http://119.147.37.168:9086/api/cms/cate/save'},

    {name: 'API_GET_CMS_CONTENT_LIST', env: 'development', api: 'http://119.147.37.168:9086/api/cms/content/list'},
    {name: 'API_GET_CMS_CONTENT_LIST', env: 'production', api: 'http://119.147.37.168:9086/api/cms/content/list'},

    {name: 'API_POST_CMS_CONTENT_SAVE', env: 'development', api: 'http://119.147.37.168:9086/api/cms/content/save'},
    {name: 'API_POST_CMS_CONTENT_SAVE', env: 'production', api: 'http://119.147.37.168:9086/api/cms/content/save'},

    {name: 'API_GET_CMS_CONTENT_TEXT', env: 'development', api: 'http://119.147.37.168:9086/api/cms/content/text'},
    {name: 'API_GET_CMS_CONTENT_TEXT', env: 'production', api: 'http://119.147.37.168:9086/api/cms/content/text'},

    {name: 'URL_LOGIN', env: 'development', api: 'http://localhost:8092'},
    {name: 'URL_LOGIN', env: 'production', api: 'http://119.147.37.168:9182'},

    {name: 'URL_INDEX', env: 'development', api: 'http://localhost:8091'},
    {name: 'URL_INDEX', env: 'production', api: 'http://119.147.37.168:9181'},

    {name: 'URL_INDEX_CMS', env: 'development', api: 'http://localhost:8093'},
    {name: 'URL_INDEX_CMS', env: 'production', api: 'http://119.147.37.168:9183'}
];

export const getAPI = function (name) {
    var api = '';
    apiTable.forEach(function(item, index) {
        if (item.name === name && item.env === process.env.NODE_ENV) {
            api = item.api;
        }
    });
    return api;
}
